home *** CD-ROM | disk | FTP | other *** search
-
- #c_source
-
- #include <exec/types.h>
- #include <proto/graphics.h>
-
- #define RED 1
- #define GREEN 2
- #define BLUE 3
- #define PALETTE 0
- #define PLUS 4
- #define MINUS 5
-
- int PaletteHook(struct IntuiMessage *msg);
- int RedHook(struct IntuiMessage *msg);
- int GreenHook(struct IntuiMessage *msg);
- int BlueHook(struct IntuiMessage *msg);
-
- /* We cannot write these functions here, since some values of the GUI are
- not declared/defined yet, but we need the prototype */
-
- #include "backfillhook.h"
-
- struct Hook clear={{0,0},HookFunc,0,COLOR(0,0)};
-
-
- #end_source
-
- projectname TestPro
-
- vbox
-
-
- HBox
-
- FRAME raised
- backfill &clear
-
- vbox
- xchar 3*2
- xpix 2*INTERWIDTH+3*4 // 2 * Spacing + 3 Sliders
-
- hbox
- Slider
- xchar 2
- xpix 4
- id RED
- hook RedHook
- tags PGA_Freedom,LORIENT_VERT
- tags GTSL_LevelPlace,PLACETEXT_BELOW
- tags GTSL_LevelFormat,(ULONG)"%2ld"
- tags GTSL_MaxLevelLen,2
- end
- Slider
- xchar 2
- xpix 4
- id GREEN
- hook GreenHook
- tags PGA_Freedom,LORIENT_VERT
- tags GTSL_LevelPlace,PLACETEXT_BELOW
- tags GTSL_LevelFormat,(ULONG)"%2ld"
- tags GTSL_MaxLevelLen,2
- end
- Slider
- xchar 2
- xpix 4
- id BLUE
- hook BlueHook
- tags PGA_Freedom,LORIENT_VERT
- tags GTSL_LevelPlace,PLACETEXT_BELOW
- tags GTSL_LevelFormat,(ULONG)"%2ld"
- tags GTSL_MaxLevelLen,2
- end
- end
- vbox
- stdline 1
- end
- end
- palette
- id PALETTE
- hook PaletteHook
- tags GTPA_Depth,2
- tags GTPA_IndicatorWidth,20
- end
- end
-
- hbox
- stdline 1
- button
- text "+"
- id 4
- end
- vbox
- end
- button
- text "-"
- id 5
- end
- end
- end
-
-
-
- #c_source
- int ActiveColor=1;
- int Red;
- int Green;
- int Blue;
-
- int PaletteHook(struct IntuiMessage *msg)
- {
- ULONG rgb;
-
- if(msg) ActiveColor=msg->Code; // This function is also called from
- // Custom(), then msg is 0
-
- rgb=GetRGB4(TestPro.Window->WScreen->ViewPort.ColorMap,ActiveColor);
-
- Red=rgb>>8;
- rgb&=0xff;
- Green=rgb>>4;
- rgb&=0xf;
- Blue=rgb;
-
- GG_SetGadgetAttrs(TestPro_Gadgets[TestPro_RED],TestPro.Window,NULL,
- GTSL_Level,Red,TAG_DONE);
- GG_SetGadgetAttrs(TestPro_Gadgets[TestPro_GREEN],TestPro.Window,NULL,
- GTSL_Level,Green,TAG_DONE);
- GG_SetGadgetAttrs(TestPro_Gadgets[TestPro_BLUE],TestPro.Window,NULL,
- GTSL_Level,Blue,TAG_DONE);
-
- return TRUE;
- }
-
- int RedHook(struct IntuiMessage *msg)
- {
- Red=msg->Code;
- SetRGB4(&TestPro.Window->WScreen->ViewPort,ActiveColor,Red,Green,Blue);
-
- return TRUE;
- }
-
- int GreenHook(struct IntuiMessage *msg)
- {
- Green=msg->Code;
- SetRGB4(&TestPro.Window->WScreen->ViewPort,ActiveColor,Red,Green,Blue);
-
- return TRUE;
- }
-
- int BlueHook(struct IntuiMessage *msg)
- {
- Blue=msg->Code;
- SetRGB4(&TestPro.Window->WScreen->ViewPort,ActiveColor,Red,Green,Blue);
- return TRUE;
- }
-
- #end_source
-
-